home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11322 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.6 KB  |  59 lines

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: CONVERTING INTEGER TO ASCII??????
  5. Date: 22 Mar 1996 18:41:32 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4ivocsINNfl1@keats.ugrad.cs.ubc.ca>
  8. References: <4i17r9$2kn@maltese.eag.unisysgsg.com> <4ic9ll$cfp@news.bridge.net> <danpop.827013499@rscernix> <4iv1a6$pl2@news.bridge.net>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <4iv1a6$pl2@news.bridge.net>,
  12. Gary Thompson <psycho@bridge.net> wrote:
  13.  >danpop@mail.cern.ch (Dan Pop) wrote:
  14.  >
  15.  >>In <4ic9ll$cfp@news.bridge.net> psycho@bridge.net (Gary Thompson) writes:
  16.  >
  17.  >>>buff=itoa(intvalue,buff,10); (I think...)
  18.  >
  19.  >>And you're wrong.  There is no itoa function in the C language.
  20.  >
  21.  >>K&R2 contains such a function (as an example), at page 64, but it has
  22.  >>only two arguments :-)
  23.  >
  24.  >Then what is this...  (badly copied from my C compiler)
  25.  
  26. Who gives a crap about your compiler? The function is not in the standard C
  27. language and that's that.
  28.  
  29.  >ª                                                                              _
  30.  >ª  Include:  <stdlib.h>                                                        _
  31.  >ª                                                                              _
  32.  >ª  Syntax:   char *itoa( int value, char *string, int radix );                 _
  33.  >ª            char *ltoa( long value, char *string, int radix );                _
  34.  >ª            char *ultoa( unsigned long value, char *string, int radix );      _
  35.  
  36. So what does that prove? That someone can write new functions that are not part
  37. of the C language and pollute a standard header with their declarations?
  38.  
  39. Don't you see that it's not an issue of what compiler environment you use?
  40. I have a function here called strdup(). That's not part of the standard.
  41. Neither is read(), write() or socket() or the <unistd.h> header. But at least
  42. these belong to some sort of standard.
  43.  
  44. If you use itoa(), your program will fail to build just about everywhere.
  45.  
  46. A good reference manual from a particular compiler environment will tell you,
  47. for each function or family of functions, what standards they adhere to. For
  48. example, my many page for strdup() claims that it is part of the BSD4.3 and
  49. SVR4 specifications; ISO9899 (the C standard) is not mentioned. The manual for
  50. write() tells me that it's blessed by POSIX.1, XPG4 and others.
  51.  
  52. What does your manual say about the standards compliance of itoa(), ltoa() and
  53. ultoa()?
  54.  
  55. If you can find itoa in Appendix B of the K&R2 book, I will mail you a box
  56. cookies.
  57. -- 
  58.  
  59.